<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 工厂函数
    function createDog(name,age,id,type){
        var dog = {};
        dog.name = name;
        dog.age = age;
        dog.id = id;
        dog.type = type;
        // 返回结果
        return dog;

    }
    var wc = createDog('旺财',6,'a9999','二哈')
    console.log(wc)
    
    // 自定义构造函数的使用 
     function MyFunction(name,age,gender,love){
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.love =  love
     }
    //  在使用构造函数的时候 我们需要使用到 js 关键字 new 一下
     var my1 = new MyFunction('李二',18,'男','足球')
     console.log(my1)
</script>
</html>